//package com.luli.config.websocketSpringBOot;
//
///**
// * 陆离
// * 2024/12/26
// */
//
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//
//import java.util.concurrent.*;
//
//@Component
//public class CpuUsageStartupRunner implements CommandLineRunner {
//
//    @Override
//    public void run(String... args) throws Exception {
////        Thread pusherThread = new Thread(new CpuUsageWebSocketHandler.CpuUsagePusher());
////        pusherThread.start();
//        /*
//         * corePoolSize线程池的核心线程数
//         * maximumPoolSize能容纳的最大线程数
//         * keepAliveTime空闲线程存活时间
//         * unit 存活的时间单位
//         * workQueue 存放提交但未执行任务的队列
//         * threadFactory 创建线程的工厂类
//         * handler 等待队列满后的拒绝策略
//         */
//        ExecutorService threadPool = new ThreadPoolExecutor(2, 5,
//            1L, TimeUnit.SECONDS,
//            new LinkedBlockingQueue<>(3),
//            Executors.defaultThreadFactory(),
//            new ThreadPoolExecutor.AbortPolicy());
//        threadPool.execute(() -> {
//            Thread pusherThread = new Thread(new CpuUsageWebSocketHandler.CpuUsagePusher());
//            pusherThread.start();
//        });
//
//
//    }
//
//    @Bean
//    public CpuUsageWebSocketHandler cpuUsageWebSocketHandler() {
//        return new CpuUsageWebSocketHandler();
//    }
//
//
//}
